# 异常的处理 bug  ->try except else finally
# try:
#     print(name)
# except:
#     print("xxl")
# try:
#     print(name)
# except NameError as e:
#     print(e)
#     print("xxl")
# try:
#     print(name)
#     1/0
# except(NameError,ZeroDivisionError):
#     print("Name","Zero")
# try:
#     f=open("C:/abc.txt","r",encoding="UTF-8")
# except Exception as e:
#     print(e)
#     f = open("C:/abc.txt", "w", encoding="UTF-8")
# else:
#     print("Right")
# finally:
#     print("OKK")
#---------------------------------------------------------
# 异常具有传递性
# def func1():
#     print("func1开始调用")
#     num = 1/0
#     print("func1结束调用")
# def func2():
#     print("func2开始调用")
#     func1()
#     print("func2结束调用")
# def main():
#     print("main开始调用")
#     try:
#        func2()
#     except:
#         print("bug")
#     print("main结束调用")
# main()
# ----------------------------------------------
# 模块的学习 -> 模块也就是 python文件 .py
# from import as

# import time
# time.sleep(2)

# from time import sleep as sl
# sl(2)

# from time import *
# sleep(2)

# import time as t
# t.sleep(2)
# -------------------------------------------------------
# my_module

# import my_moudle1
# my_moudle1.test(1,2)
# from my_moudle1 import test
# from my_moudle2 import test #后一个，也就是这个会覆盖掉前一个
# test(1,2)
# # __name__ __all__ *
# # __name__ ->每个py文件都有 只有在当前程序中运行__name__==__main__
# # __all__ 用它控制import* 引用那些东西
#
# import my_moudle3  #->输出3
# from my_moudle3 import *
# test(1,2)
# test2(1,2)
# ------------------------------------------------------------
# from 不用写上一级 sleep()
# import 需要写上一级 time.sleep()

